using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DTO;
using DAL;
using BUS;
using Encosia;

public partial class Danhsachhinh_theosp : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        loaddl();

    }

    private void loaddl()
    {
        int id = int.Parse(Request.QueryString["id"].ToString());
        tbsanphamDTO sp = tbsanphamBUS.GetByID(id);
        hp_tensp.Text = sp.Tensp;
        hp_tensp.NavigateUrl ="~/Admin/sanphamct.aspx?id=" + id.ToString();

        Repeater1.DataSource = tbhinhanhBUS.gethinh(id);
        Repeater1.DataBind();
        
    }
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem ||
            e.Item.ItemType == ListItemType.Item)
        {
            tbhinhanhDTO hinhanh = (tbhinhanhDTO)e.Item.DataItem;
            
            // HyperLink tensp = (HyperLink)e.Item.FindControl("hp_tensp");
            //tensp.Text = sp.Tensp.ToString();
            Label tenhinh = (Label)e.Item.FindControl("lb_tenhinh");
            tenhinh.Text = hinhanh.Tenhinhanh.ToString();
            HighslideImage hinh = (HighslideImage)e.Item.FindControl("hinh_anh");
            hinh.ImageUrl = "~/Admin/image/hinhnho/" + hinhanh.Tenhinhanh;
            hinh.FullImageURL = "~/Admin/image/thump/" + hinhanh.Tenhinhanh;
        }
    }
}
